<?php

/**
 * Jquery UI Date Picker Class
 *
 * @version $1.0.0.1$
 * @copyright 2010 by masmeka (masmeka@gmail.com)
 */
class jDatePicker {

    var $__urlPath;
    var $__params = array();
    var $__elements = array();
    var $__changeMonth = true;
    var $__changeYear = true;
    var $__showOn = 'both';
    var $__buttonImage = 'calendar.gif';
    var $__buttonImageOnly = true;
    var $__dateFormat = 'dd-mm-yy';

    function __construct($urlPath = "") {
        global $__CFG_http_component;
        if ($urlPath != "")
            $this->__urlPath = $urlPath;
        else
            $this->__urlPath = base_url() . "/style/component/jquery-ui/";

        $this->__buttonImage = $this->__urlPath . $this->__buttonImage;
    }

    function init() {
        echo "<link href=\"" . $this->__urlPath . "jquery-ui.css\" rel=\"stylesheet\" type=\"text/css\"/>";
    }

    function generateDP($elementID) {
        echo "jQuery(function() {\n";
        echo "	jQuery('#" . $elementID . "').datepicker({\n";
        echo "		changeMonth: " . ($this->__changeMonth ? "true" : "false") . ",\n";
        echo "		changeYear: " . ($this->__changeYear ? "true" : "false") . ",\n";
        echo "		showOn: '" . $this->__showOn . "',\n";
        echo "		buttonImage: '" . $this->__buttonImage . "',\n";
        echo "		buttonImageOnly: " . ($this->__buttonImageOnly ? "true" : "false") . ",\n";
        echo "		showButtonPanel: false,\n";
        echo "		dateFormat: '" . $this->__dateFormat . "'\n";
        echo "	})\n";
        echo "});\n";
    }

}

?>
